//
//  WJFullAccessCardCell.swift
//  PDFSign
//
//  Created by 李永彬 on 2025/9/29.
//

import UIKit

class WJFullAccessCardCell: UITableViewCell {
    
    // 会员卡片标题
    private lazy var accessTitleLabel: UILabel = {
        let label = UILabel()
        label.text = "Get FULL Access"
        label.font = UIFont.boldSystemFont(ofSize: 18)
        label.textColor = .white
        return label
    }()
    
    // 会员卡片描述
    private lazy var accessDescLabel: UILabel = {
        let label = UILabel()
        label.text = "Use all packages unlimited!"
        label.font = UIFont.systemFont(ofSize: 14)
        label.textColor = .white.withAlphaComponent(0.9)
        return label
    }()
    
    // 会员卡片图标
    private lazy var accessImageView: UIImageView = {
        let iv = UIImageView()
        iv.image = UIImage(systemName: "crown.fill")
        iv.tintColor = .white
        iv.contentMode = .scaleAspectFit
        return iv
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI() {
        backgroundColor = .clear
        contentView.backgroundColor = .clear
        
        // 创建卡片容器
        let cardView = UIView()
        cardView.backgroundColor = .systemBlue
        cardView.layer.cornerRadius = 20
        cardView.clipsToBounds = true
        contentView.addSubview(cardView)
        
        // 添加子视图
        cardView.addSubview(accessTitleLabel)
        cardView.addSubview(accessDescLabel)
        cardView.addSubview(accessImageView)
        
        // 约束
        cardView.snp.makeConstraints { make in
            make.edges.equalToSuperview().inset(UIEdgeInsets(top: 10, left: 20, bottom: 10, right: 20))
        }
        
        accessTitleLabel.snp.makeConstraints { make in
            make.top.equalToSuperview().offset(20)
            make.left.equalToSuperview().offset(20)
        }
        
        accessDescLabel.snp.makeConstraints { make in
            make.top.equalTo(accessTitleLabel.snp.bottom).offset(8)
            make.left.equalTo(accessTitleLabel)
        }
        
        accessImageView.snp.makeConstraints { make in
            make.right.equalToSuperview().offset(-20)
            make.centerY.equalToSuperview()
            make.width.height.equalTo(60)
        }
    }
}

